package com.catsic.web.controllers;

import java.util.HashMap;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.catsic.base.controller.BaseController;
import com.catsic.mod.condition.SendMessageCondition;
import com.catsic.mod.service.SendMessageService;


@Controller
@RequestMapping("/sendMessage")
public class SendMessageControlle extends BaseController{

	@Autowired
	private SendMessageService sendMessageService;
	
	/**
	 * 查询发件箱
	 * @param condition
	 * @param pageable
	 * @return
	 */
	@RequestMapping(value = "/query" , method = RequestMethod.GET)
	@ResponseBody
	public Map<String,Object> query(SendMessageCondition condition,Pageable pageable){
		Map<String,Object> result= new HashMap<String,Object>();
		result.put(CONTENT,sendMessageService.findAll(condition, pageable));
		result.put(RESULT,RESULT_SUCCESS);
		return result;
	}
	
	/**
	 * delete:删除信息
	 * @author cs
	 * @param id
	 * @return
	 */
	@RequestMapping(value = "/delete")
	@ResponseBody
	public Map<String,Object> delete(String id){
		sendMessageService.delete(id);
		Map<String,Object> result= new HashMap<String,Object>();
		result.put(RESULT, RESULT_SUCCESS);
		return result;
	}
}
